import request from '@/utils/request'

// 登录方法
export function login(username, password) {
  const data = {
    username,
    password,
    owner: 'MIDDLE_MANAGER'
  }
  return request({
    url: 'user/login',
    headers: {
      isToken: false,
      repeatSubmit: false
    },
    method: 'post',
    data: data
  })
}

// 注册方法
export function register(data) {
  return request({
    url: '/api/user/register',
    headers: {
      isToken: false
    },
    method: 'post',
    data: data
  })
}

// 获取用户详细信息
export function getInfo(data) {
  return request({
    url: '/admin/GetAdminByUserName',
    method: 'post',
    // headers: {
    //   'content-Type': 'multipart/form-data'
    // },
    data
  })
}

// 获取验证码
export function getCode(data) {
  return request({
    url: '/api/user/send-sms-code',
    headers: {
      isToken: false
    },
    method: 'post',
    data,
    timeout: 20000
  })
}

// 验证码登录 
export function loginByCode(data) {
  return request({
    url: '/api/user/codelogin',
    method: 'post',
    data
  })
}